#include "FrameInfo.hpp"

namespace sl
{
	FrameInfo::FrameInfo() : myFrame(0), myDelay(0), myOffset(sf::Vector2i(0, 0))
	{}

	FrameInfo::FrameInfo(unsigned int frame, unsigned int delay, const sf::Vector2i& offset) : myFrame(frame), myDelay(delay), myOffset(offset)
	{}

	FrameInfo* FrameInfo::SetFrame(unsigned int frame)
	{
		myFrame = frame;
		return this;
	}

	unsigned int FrameInfo::GetFrame()
	{
		return myFrame;
	}

	FrameInfo* FrameInfo::SetDelay(unsigned int delay)
	{
		myDelay = delay;
		return this;
	}

	unsigned int FrameInfo::GetDelay()
	{
		return myDelay;
	}

	FrameInfo* FrameInfo::SetOffset(const sf::Vector2i& offset)
	{
		myOffset = offset;
		return this;
	}

	sf::Vector2i FrameInfo::GetOffset()
	{
		return myOffset;
	}

	std::ostream& operator<<(std::ostream& os, const FrameInfo& info)
	{
		return os << info.myFrame << info.myDelay << info.myOffset.x << info.myOffset.y;
	}

	std::istream& operator>>(std::istream& is, FrameInfo& info)
	{
		return is >> info.myFrame >> info.myDelay >> info.myOffset.x >> info.myOffset.y;
	}
}